<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="../../common/tagInclude.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
	<base href="${basePath}" />
	<title>数据库备份管理</title>
	<META http-equiv="content-type" content="text/html; charset=UTF-8">
	<LINK href="${basePath}styleAdmin/css/portalinabox.css" type="text/css" rel="stylesheet">		
	<meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
   <meta http-equiv="expires" content="0">
	<script type="text/javascript" src="${basePath}styleAdmin/js/prototype-1.6.0.3.js"></script>
	<script type="text/javascript" src="${basePath}styleAdmin/js/common.js"></script>
	<script type="text/javascript">
		function dbDumpOpr(sqlFile,cate){
			var message = "" ;
			var url = "" ;
			if(cate == 'export'){
				message = "确定导入,将覆盖当前的数据?" ;
				url = "${basePath}admin/dbTable/exportData?sqlFile=" + sqlFile ;
			}
			if(cate == 'load'){
				message = "确定下载?" ;
				url = "${basePath}admin/dbTable/dataLoad?sqlFile=" + sqlFile ;
			}
			if(cate == 'del'){
				message = "确定删除备份文件?" ;
				url = "${basePath}admin/dbTable/dataDelete?sqlFile=" + sqlFile ;
			}
			if(cate == 'delAll'){
				var all_checkbox = document.getElementsByName("sqlFile");
				var len = all_checkbox.length;
				if(isChecked("sqlFile") == false ){
					alert('至少选择一项');
					return ;
				}else{
					var values = "";
					for(var i=0;i<len ;i++){
						if(all_checkbox[i].checked)
							values += "," + all_checkbox[i].value;
					}
					if(values.length > 1)
						values = values.substring(1);
				}
				message = "确定删除所选备份文件?" ;
				sqlFile = values ;
				url = "${basePath}admin/dbTable/dataDeleteAll?sqlFile=" + sqlFile ;
			}
			if(!confirm(message))return;
			window.location = url ;
		}
	</script>
</HEAD>
<body bottomMargin="0" leftMargin="0" topMargin="0" rightMargin="0">
<form action="" method="get" name="myform">
<%@include file="../common/navigate.jsp" %>
<table width="96%" border="0" align="center" cellpadding="0" style="margin-top:5px;" cellspacing="0">
	<tr>
		<td valign="top">
			<!-- 搜索栏 -->
			<table width="100%" border="1" class="mainFunctionTable"  cellpadding="0" cellspacing="1">
				<tr height="25" class="pLabel">
			   		<td class="td_nwarpstyle">&nbsp;&nbsp;数据库备份管理</td>
			 	</tr>
			 </table>
		  </td>
	  </tr>
	  <tr>
	    <td>
			&nbsp;&nbsp;<a href="javascript:checkAll('sqlFile',true);">全选</a>
			&nbsp;&nbsp;<a href="javascript:checkAll('sqlFile',false);">全不选</a>
			&nbsp;&nbsp;[<a href="javascript:dbDumpOpr('sqlFile','delAll');">删除所选</a>]
			<table width=100% border=1 class="mainFunctionTable"  cellpadding="0" cellspacing="1" id="table_channel">
				<tr height=25 class="pLabel" align="center">
					<td width="5%" class="td_nwarpstyle">标识</td>
					<td width="20%" class="td_nwarpstyle">文件名称</td>
					<td width="20%" class="td_nwarpstyle">备份时间</td>
					<td width="20%" class="td_nwarpstyle">文件大小</td>
					<td width="10%" class="td_nwarpstyle">操作</td>
				</tr>
			</table>
			<table width=100% border=1 class="mainFunctionTable"  cellpadding="0" cellspacing="1" id="table_channel">
				<c:forEach items="${sqlFileInfoList}" var="fileInfo" varStatus="status">
	   					<c:choose>
	   						<c:when test="${status.index % 2 == 0 }"><c:set var="css" value="c1" /></c:when>
	   						<c:otherwise><c:set var="css" value="c2" /></c:otherwise>
	   					</c:choose>
					<tr height="28" class="${css}">
						<td width="5%" align="center"><input type="checkbox" name="sqlFile" id="sqlFile" value="${fileInfo.fileName}"/></td>
						<td width="20%" align="center">${fileInfo.fileName}</td>
						<td width="20%" align="Center">${fileInfo.lastModified}</td>
						<td width="20%" align="Center">${fileInfo.fileSize}B</td>
						<td width="10%" align=center>
							<a href="javascript:dbDumpOpr('${fileInfo.fileName}','export');">导入</a>&nbsp;&nbsp;
							<a href="javascript:dbDumpOpr('${fileInfo.fileName}','load');">下载</a>&nbsp;&nbsp;
							<a href="javascript:dbDumpOpr('${fileInfo.fileName}','del');">删除</a>&nbsp;&nbsp;
						</td>
					</tr>
				</c:forEach>
	  		</table>
		 </td>
	   </tr>
		<tr>
		   <td height=25>
		   	<c:set var="pageURL" value="${basePath}admin/dbTable/exportList?"/>
			<%@include file="../common/page.jsp"%>
		  </td>
	  </tr>
</table>
</form>
</body>
</HTML>